Macros That Play: Migrating from Java to Maya

نویسندگان

  • Jason Baker
  • Wilson C. Hsieh
  • Matthew Flatt
  • Jay Lepreau
  • Gary Lindstrom
  • Thomas C. Henderson
  • David S. Chapman
چکیده

Maya is a version of Java that allows users to write their own syntax extensions, which are called Mayans. Mayans can reinterpret or extend Maya syntax by expanding it to other Maya syntax: they operate on abstract syntax trees, and their expansion is triggered during parsing as semantic actions. Maya’s expressiveness comes from treating grammar productions as generic functions, and Mayans as multimethods on those generic functions. Mayans are defined using a rich set of parameter specializers: Mayans can be dispatched on type of an AST node, the static type of an expression, the value of a token, or the substructure of any AST node. Multiple dispatch allows users to extend the semantics of the language by overriding the language’s base actions. This thesis explores explores the design and implementation space for compiletime meta-programming systems through Maya. Maya uses multiple-dispatch to provide an expressive meta-programming environment. Maya also uses novel implementation techniques to statically detect certain errors in code that builds syntax trees. We use MultiJava (described at OOPSLA 2000) as an example of the syntax and semantics extensions that can be expressed in Maya.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Adsorption Performance of Low-cost Java Plum Leaves and Guava Fruits as Natural Adsorbents for Removal of Free Fatty Acids from Coconut Oil

This study assesses the adsorption performance of Java plum leaves and guava fruits based adsorbents as natural products widely available in Aceh, Indonesia. These renewable adsorbents were employed to remove free fatty acids (FFAs) that cause the rancid odor in coconut oil. The adsorption tests were carried out at three different doses (50, 75, 100 g) and seven agitating periods (1, 2, 3, 4, 5...

متن کامل

Automata via Macros

Lisp programmers have long used macros to extend their language. Indeed, their success has inspired macro notations for a variety of other languages, such as C and Java. There is, however, a paucity of effective pedagogic examples of macro use. This paper presents a short, non-trivial example that implements a construct not already found in mainstream languages. Furthermore, it motivates the ne...

متن کامل

Fully-parameterized, first-class modules with hygienic macros

It is possible to define a formal semantics for configuration, elaboration, linking, and evaluation of fully-parameterized first-class modules with hygienic macros, independent compilation, and code sharing. This dissertation defines such a semantics making use of explicit substitution to formalize hygienic expansion and linking. In the module system, interfaces define the static semantics of m...

متن کامل

The Semantics of Syntax Applying Denotational Semantics to Hygienic Macro Systems

Typically, when semanticists hear the words “Scheme” or “Lisp”, what comes to mind is “untyped lambda calculus plus higher-order state and first-class control”. Given our typical concerns, this seems to be the essence of Scheme: it is a dynamically typed applied lambda calculus that supports mutable data and exposes first-class continuations to the programmer. These features expose a complete c...

متن کامل

Building language towers with Ziggurat

Ziggurat is a meta-language system that permits programmers to develop Scheme-like macros for languages with nontrivial static semantics, such as C or Java (suitably encoded in an S-expression concrete syntax). Ziggurat permits language designers to construct “towers” of language levels with macros; each level in the tower may have its own static semantics, such as type systems or flow analyses...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2001